import React, { Component } from "react";
import Taro from '@tarojs/taro';
import { View,Image,Text,Button,Input } from '@tarojs/components';
import { AtTabs, AtTabsPane,AtButton, AtModal, AtModalHeader, AtModalContent, AtModalAction} from 'taro-ui';
import './mineji.scss'
class Mineji extends Component {
    constructor () {
        super(...arguments)
        this.state = {
          current: 0,
          isOpen:false,
          listdetail:[]
        }
      }
      handleClick (value) {
        this.setState({
          current: value
        })
      }
      handleClose=()=>{
        this.setState({isOpen:false})
    }
    handleCancel=()=>{
        this.setState({isOpen:false})
    }
    handleConfirm=()=>{
        this.setState({
            isOpen:false
        })
    }
    gotoguizhe(){
      Taro.navigateTo({
        url: '../../pages/mineguizhe/mineguizhe'
      })
    }
    gotojifen(){
      Taro.navigateTo({
        url: '../../pages/minejifen/minejifen'
      })
    }
      componentDidMount() {
        this.getListDetail();
      }
      getListDetail(){
        Taro.request({
          method:"POST",
          url: 'http://123.57.67.148:3000/mock/573/newproduct',
          data: {
            listdetail: 'listdetail',
            bar: 10
          },
          header: {
            'content-type': 'application/json'
          }
        })
          .then(res =>{
            this.setState({
              listdetail:res.data.newproduct
            })
            console.log(res.data)
          })
      }
    render () {
      return <View className='container'>
        <View className='jifentop' >
          <View>
            <Text>可用积分</Text>
          </View>
          <View>
            <Text>1500</Text>
          </View>
          <View style='font-size:18px'>
            <Text className='topleft' onClick={this.gotoguizhe}>如何获取积分</Text>
            <Text className='topright' onClick={this.gotojifen}>积分商城</Text>
          </View>
        </View>
          <AtTabs
  current={this.state.current}
  scroll
  tabList={[
    { title: '全部' },
    { title: '获取' },
    { title: '消耗' }
  ]}
  onClick={this.handleClick.bind(this)}>
    <AtTabsPane current={this.state.current} index={0}>
    <View style='font-size:18px'>
      <View className='ji'>
        <View className='jileft'>
          <View>
            <Text>积分商城兑换50积分</Text>
          </View>
          <View style='font-size:14px'>
            <Text>2017-08-15 10:25:42</Text>
          </View>
          
        </View>
        <View className='jiright'>
          <Text>-50</Text>
          </View>
      </View>
      <View className='ji'>
        <View className='jileft1'>
          <View>
            <Text>下单2017081502541368时赠送积分</Text>
          </View>
          <View style='font-size:14px'>
            <Text>2017-08-15 10:25:42</Text>
          </View>
          
        </View>
        <View className='jiright1'>
          <Text>+80</Text>
          </View>
      </View>
      <View className='ji'>
        <View className='jileft2'>
          <View>
            <Text>签到赠送积分</Text>
          </View>
          <View style='font-size:14px'>
            <Text>2017-08-15 10:25:42</Text>
          </View>
          
        </View>
        <View className='jiright2'>
          <Text>+2</Text>
          </View>
      </View>
</View>
  </AtTabsPane>
  <AtTabsPane current={this.state.current} index={1}>
    <View style='font-size:18px;text-align:center;height:100px;'>标签页二的内容</View>
  </AtTabsPane>
  <AtTabsPane current={this.state.current} index={2}>
    <View style='font-size:18px;text-align:center;height:100px;'>标签页三的内容</View>
  </AtTabsPane>
  
</AtTabs>
          </View>
          
    }
  }
  
  export default Mineji